/**
 * 泛型使用
 */
function maxValue<T>(args: T[]) {
    let max = args[0]
    args.forEach(item => max = item > max ? item : max)
    return max
}
maxValue<number>([1,2,5,7])
maxValue<string>(["a","b","c"])

function getValue<T,K>(pa1:T,pa2:K){

}
getValue<number,string>(1,"xiaowang")

/**
 * 定义一个函数，接受一个对象，接受key，返回value
 */
interface IUser {
    id:number,
    name:string
}
interface IStu {
    age:number,
    weight:number
}
const user:IUser = {
    id:1,name:"xiaowang"
}
const student = {
    age:23,
    weight:156
}

function findObj<T>(obj:T,key:string){
    // return obj[key]
}

findObj<IUser>(user,"id")
findObj(student,"age")

export {}

